﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/PBOAMasterPage.master"
  AutoEventWireup="true" CodeFile="AddModify.aspx.cs" Inherits="MsgMng_AddModify" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
  <title>编辑消息</title>
  <style>
    #rightContentPlaceHolder .mytable { border: solid 1px gray; width: 98%; margin: 10px auto; }
    #rightContentPlaceHolder .title { position: relative; top: -10px; background-color: White; }
  </style>
  <script>
    function ClientValidate(source, args)
    {
      if (isNaN(new Date(args.Value)))
        args.IsValid = false;
      else
        args.IsValid = true;
    }
  </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
  <asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional">
  <Triggers>
  <asp:PostBackTrigger ControlID="bSaveMsg" />
  </Triggers>
  <ContentTemplate>
    <table class="mytable">
      <thead>
        <tr>
          <td>
            <span class="title">消息填写区</span>
          </td>
          <td>
          </td>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td style="font-weight: bold;">
            消息标题：
          </td>
          <td>
            <asp:TextBox ID="tbTitle" runat="server"></asp:TextBox><asp:RequiredFieldValidator
              ID="revTitle" runat="server" ErrorMessage="请填写消息标题！" ControlToValidate="tbTitle"></asp:RequiredFieldValidator>
          </td>
        </tr>
        <tr>
          <td>
            消息类型：
          </td>
          <td>
            <asp:DropDownList ID="ddlMessageType" runat="server" DataSourceID="edsMessageType"
              DataTextField="MessageTypeId" DataValueField="MessageTypeNo">
            </asp:DropDownList>
            <asp:EntityDataSource ID="edsMessageType" runat="server" ConnectionString="name=MyOfficeEntities"
              DefaultContainerName="MyOfficeEntities" EnableFlattening="False" EntitySetName="MessageTypes">
            </asp:EntityDataSource>
          </td>
        </tr>
        <tr>
          <td>
            开始有效时间：
          </td>
          <td>
            <asp:TextBox ID="tbStartTime" runat="server"></asp:TextBox>
            <asp:CustomValidator ID="cvStartTime" runat="server" ErrorMessage="格式错误！" ControlToValidate="tbStartTime"
              ValidateEmptyText="True" ClientValidationFunction="ClientValidate"></asp:CustomValidator>
          </td>
        </tr>
        <tr>
          <td>
            结束有效时间：
          </td>
          <td>
            <asp:TextBox ID="tbEndTime" runat="server"></asp:TextBox>
            <asp:CustomValidator ID="cvEndTime" runat="server" ErrorMessage="格式错误！" ValidateEmptyText="true"
              ClientValidationFunction="ClientValidate" ControlToValidate="tbEndTime"></asp:CustomValidator>
          </td>
        </tr>
        <tr>
          <td>
            发送对象：
          </td>
          <td>
            <asp:RadioButton ID="rbAllUsers" runat="server" Text="所有人" GroupName="Scope" AutoPostBack="True"
              OnCheckedChanged="rbAllUsers_CheckedChanged" />
            <asp:RadioButton ID="rbSelectUsers" runat="server" Text="选择特定对象" GroupName="Scope"
              Checked="True" AutoPostBack="True" OnCheckedChanged="rbSelectUsers_CheckedChanged" />
          </td>
        </tr>
        <tr>
          <td>
          </td>
          <td>
            <fieldset runat="server" id="fsScope">
              <legend>
                <img src="../Images/search2.gif" width="20" />筛选范围：</legend>
              <asp:CheckBoxList ID="cblBy" runat="server" RepeatDirection="Horizontal" AutoPostBack="True"
                OnSelectedIndexChanged="cblBy_SelectedIndexChanged">
                <asp:ListItem Value="depart">按部门</asp:ListItem>
                <asp:ListItem Value="userno">按员工号</asp:ListItem>
                <asp:ListItem Value="username" Selected="True">按姓名</asp:ListItem>
              </asp:CheckBoxList>
              <uc:DepartmentSelector ID="ds" runat="server" Enabled="False" />
              <br />
              员工号：<asp:TextBox ID="tbUserId" runat="server" Height="18px" Width="51px" Enabled="False"></asp:TextBox>
              姓名：<asp:TextBox ID="tbUserName" runat="server" Height="19px" Width="67px"></asp:TextBox>
              (模糊查找 eg:李)<br />
              <asp:Button ID="bSearch" runat="server" Text="确定搜索范围" CausesValidation="False" OnClick="bSearch_Click" />
            </fieldset>
            <fieldset runat="server" id="fsScope2">
              <legend>请选择发送对象</legend>
              <asp:CheckBox ID="cbCheckAll" runat="server" Font-Bold="True" Text="全选" AutoPostBack="True"
                OnCheckedChanged="cbCheckAll_CheckedChanged" />
              <asp:CheckBoxList ID="cblUsers" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"
                DataTextField="UserName" DataValueField="UserNo">
              </asp:CheckBoxList>
            </fieldset>
          </td>
        </tr>
        <tr>
          <td>
            消息内容：
          </td>
          <td>
            <asp:TextBox ID="tbContent" runat="server" TextMode="MultiLine" Height="156px" Width="568px"></asp:TextBox>
          </td>
        </tr>
        <tr>
          <td>
          </td>
          <td style="text-align: right;">
            <asp:Button ID="bSaveMsg" runat="server" Text="保存消息" onclick="bSaveMsg_Click" />
            <asp:Button ID="bReturn" runat="server" Text="返回" CausesValidation="False" PostBackUrl="~/MsgMng/Default.aspx"
              Style="height: 21px" />
          </td>
        </tr>
      </tbody>
    </table>
    </ContentTemplate>
  </asp:UpdatePanel>
</asp:Content>
